<{extend name="public/layout"}>


<{block name="content"}>
<div class="content-wrapper">
    <!-- 面包屑导航 -->
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">

                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a href="<{:url('/admin/index/index')}>">首页</a></li>
                        <li class="breadcrumb-item"><a href="#">系统设置</a></li>
                        <li class="breadcrumb-item active">支付配置</li>
                    </ol>
                </div>
            </div>
        </div>
    </section>

    <!-- 内容区-->
    <section class="content">
        <div class="container-fluid">
            <div class="row">
                <{if $form=='alipay'}>

                <div class="col-md-12">
                    <div class="btn-group-lg" style="margin-bottom: 20px;text-align: center">您可以去配置微信支付：<a   href="<{:url(null,['form'=>'wechat'])}>">微信支付</a></div>
                    <div class="card card-primary">
                        <div class="card-header">
                            <h3 class="card-title">支付宝配置</h3>

                            <div class="card-tools">
                                <button type="button" class="btn btn-tool" data-card-widget="collapse">
                                    <i class="fas fa-minus"></i>
                                </button>
                                <button type="button" class="btn btn-tool" data-card-widget="remove">
                                    <i class="fas fa-times"></i>
                                </button>
                            </div>
                        </div>
                        <form method="post" action="<{:url('/admin/system.index/pay_action')}>" id="pay-alipay">
                            <div class="card-body">
                                <div class="form-group">
                                    <label for="ali_app_id">应用APPID</label>
                                    <input name="app_id" autocomplete="off" value="<{:isset($data.app_id)?$data.app_id:''}>" type="text" class="form-control" id="ali_app_id" placeholder="应用的appid">
                                    <input type="hidden" name="form" value="alipay">
                                    <span class="bs-red">支付宝开发者平台创建的特定应用appid</span>
                                </div>

                                <div class="form-group">
                                    <label for="public_key">支付宝公钥</label>
                                    <textarea rows="3" name="public_key" autocomplete="off"  class="form-control" id="public_key" placeholder="应用公钥"><{:isset($data.public_key)?$data.public_key:''}></textarea>
                                    <span class="bs-red">上传公钥后生成的支付宝公钥！！！一定是网站应用后台配置公钥后生成的支付宝公钥。</span>
                                </div>
                                <div class="form-group">
                                    <label for="private_key">私钥private_key</label>
                                    <textarea rows="8" name="private_key" autocomplete="off"  class="form-control" id="private_key" placeholder="私钥"><{:isset($data.private_key)?$data.private_key:''}></textarea>
                                    <span class="bs-red">应用私钥</span>
                                </div>

                            </div>
                            <div class="card-footer">
                                <button type="button" onclick="layer.confirm('确定提交保存吗',{title:0},function() {
                                      form_submit([],'',false,false,'pay-alipay')
                                    })" class="btn btn-primary">提交保存</button>
                            </div>
                        </form>
                    </div>

                </div>
                <{else}>
                <div class="col-md-12">
                    <div class="btn-group-lg" style="margin-bottom: 20px;text-align: center">您可以去配置支付宝：<a   href="<{:url(null,['form'=>'alipay'])}>">支付宝配置</a></div>
                    <div class="card card-success">
                        <div class="card-header">
                            <h3 class="card-title">微信支付配置</h3>

                            <div class="card-tools">
                                <button type="button" class="btn btn-tool" data-card-widget="collapse">
                                    <i class="fas fa-minus"></i>
                                </button>
                                <button type="button" class="btn btn-tool" data-card-widget="remove">
                                    <i class="fas fa-times"></i>
                                </button>
                            </div>
                        </div>
                        <div class="alert alert-warning">
                            授权需要在公众号提取以下信息；给公众号授权域名添加当前请求的域名；在微信支付时需要用openid。要配置微信提取信息请到这里：<a href="<{:url('wechat')}>">公众号配置</a>
                        </div>
                        <form method="post" action="<{:url('/admin/system.index/pay_action')}>" id="pay-wechat">
                            <div class="card-body">
                                <div class="form-group">
                                    <label for="app_id">appid</label>
                                    <input name="app_id" autocomplete="off" value="<{:isset($data.app_id)?$data.app_id:''}>" type="text" class="form-control" id="app_id" placeholder="公众号appid">
                                    <input type="hidden" name="form" value="wechat">
                                    <span class="bs-red">公众号appid</span>
                                </div>
                                <div class="form-group">
                                    <label for="mch_id">mch_id</label>
                                    <input name="mch_id" autocomplete="off" value="<{:isset($data.mch_id)?$data.mch_id:''}>" type="text" class="form-control" id="mch_id" placeholder="微信支付商户id">
                                    <span class="bs-red">微信支付商户id</span>
                                </div>
                                <div class="form-group">
                                    <label for="mch_key">商户支付秘钥</label>
                                    <input name="mch_key" autocomplete="off" value="<{:isset($data.mch_key)?$data.mch_key:''}>" type="password" class="form-control" id="mch_key" placeholder="微信商户支付秘钥">
                                    <span class="bs-red">微信商户支付秘钥</span>
                                </div>
                                <div class="form-group">
                                    <label for="cert_pem">商户支付证书cert_pem</label>
                                    <textarea rows="5" name="cert_pem" autocomplete="off"  class="form-control" id="cert_pem" placeholder="微信商户支付秘钥"><{:isset($data.cert_pem)?$data.cert_pem:''}></textarea>
                                    <span class="bs-red">商户支付证书cert_pem</span>
                                </div>
                                <div class="form-group">
                                    <label for="key_pem">商户支付私钥key_pem</label>
                                    <textarea rows="5" name="key_pem" autocomplete="off"  class="form-control" id="key_pem" placeholder="微信商户支付私钥"><{:isset($data.key_pem)?$data.key_pem:''}></textarea>
                                    <span class="bs-red">商户支付私钥key_pem</span>
                                </div>

                            </div>
                            <div class="card-footer">
                                <button type="button" onclick="layer.confirm('确定提交保存吗',{title:0},function() {
                                      form_submit([],'',false,false,'pay-wechat')
                                    })" class="btn btn-success">提交保存</button>
                            </div>
                        </form>
                    </div>

                </div>
                <{/if}>
            </div>

        </div>
    </section>
</div>
<{/block}>